package itheima.d02;
//直接创建匿名内部类
import javax.management.MBeanAttributeInfo;

public class ThreadTest2_2 {
    public static void main(String[] args) {

        Runnable target = new Runnable() {
            @Override
            public void run() {
                for (int i = 1; i <= 5; i++) {
                    System.out.println("线程：" + i);
                }

            }
        } ;
        Thread t1 = new Thread(target);
        t1.start();

        //简化形式1：
        new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 1; i <= 5; i++) {
                    System.out.println("线程2：" + i);
                }

            }
        }).start();

        //简化形式2：lambda
        new Thread(() -> {
            for (int i = 1; i <= 5; i++) {
                System.out.println("线程3：" + i);
            }

        }).start();

        for (int i = 1; i <= 5; i++) {
            System.out.println("主线程main：" + i);
        }

    }
}
